package com.demo.strategy.pay;

import java.util.HashMap;
import java.util.Map;

/**
 * @Author likz
 * @Date 2025/7/24 16:21
 * @Description
 **/
public class PayStrategy {


    public static final String JDPay = "JDPay";
    public static final String ALIPAY = "Alipay";
    public static final String DEFAULT = "Alipay";

    private static Map<String, Payment> strategy = new HashMap<>();
    static {
        strategy.put(JDPay, new JDPay());
        strategy.put(ALIPAY, new Alipay());
    }
    public static Payment getPayment(String payKey) {
        if (!strategy.containsKey(payKey)) {
            return strategy.get(ALIPAY);
        }
        return strategy.get(payKey);
    }

}
